package com.cjm.lecode;

import java.util.Arrays;

public class ArrayChaFen {
    public static int xx(int[] nums) {
        Arrays.sort(nums);
        int index = nums.length - 2;
        int sum = 0;
        for (int i = nums.length - 1; i >= 0; i--) {
            if (i == index) {
                sum += nums[i];
                index -= 2;
            }
        }
        return sum;
    }

    public static void main(String[] args) {
        System.err.println(xx(new int[] {1, 4, 3, 2}));
        System.err.println(xx(new int[] {6, 2, 6, 5, 1, 2}));
    }
}
